<?php echo $header; ?>
<div id="content">
  <div class="breadcrumb">
    <?php foreach ($breadcrumbs as $breadcrumb) { ?>
    <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
    <?php } ?>
  </div>
  <?php if ($error_warning) { ?>
  <div class="warning"><?php echo $error_warning; ?></div>
  <?php } ?>
  <?php if ($success) { ?>
  <div class="success"><?php echo $success; ?></div>
  <?php } ?>
  <div class="box">
    <div class="heading">
      <h1><img src="view/image/country.png" alt="" /> <?php echo $heading_title; ?></h1>
       <div class="buttons"><a onclick="upload();" class="button"><span><?php echo $button_save; ?></span></a></div>
    </div>
    <div class="content">
      <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form">
            
        <table id="urls" class="list">
            <thead>
              <tr>
                
                <td class="left"><?php echo $short_url; ?></td>
                <td class="left"><?php echo $route_url; ?></td>
                <td></td>
              </tr>
            </thead>
            <?php $url_row = 0; ?>
            <?php foreach ($urls as $url) { ?>
            <tbody id="url-row<?php echo $url_row; ?>">
              <tr>
                
                <td class="left">
                  <input size="80" type="text" name="urls[<?php echo $url_row; ?>][keyword]" value="<?php echo $url['keyword']; ?>" />
                  </td>
                  <td class="left"><input size="80" type="text" name="urls[<?php echo $url_row; ?>][query]" value="<?php echo $url['query']; ?>" />
                  </td>
                <td class="left"><a onclick="$('#url-row<?php echo $url_row; ?>').remove();" class="button"><?php echo $button_remove; ?></a></td>
              </tr>
            </tbody>
            <?php $url_row++; ?>
            <?php } ?>
            <tfoot>
              <tr>
                <td colspan="2"></td>
                <td class="left"><a onclick="addUrl();" class="button"><?php echo $button_add_url; ?></a></td>
              </tr>
            </tfoot>
          </table>
      </form>
      
    </div>
  </div>
</div>





<script type="text/javascript"><!--
var url_row = <?php echo $url_row; ?>;

function addUrl() {
	html  = '<tbody id="url-row' + url_row + '">';
    html += '  <tr>';
	
	
	html += '<td class="left"><input size="60" type="text" name="urls[' + url_row + '][keyword]" value="" /></td>';
	html += '    <td class="left"><input size="60" type="text" name="urls[' + url_row + '][query]" value="" /></td>';
    
	
	html += '    <td class="left"><a onclick="$(\'#url-row' + url_row + '\').remove();" class="button"><?php echo $button_remove; ?></a></td>';
    html += '  </tr>';	
    html += '</tbody>';
	
	$('#urls tfoot').before(html);
	
	
	url_row++;
}


//--></script>


<script type="text/javascript"><!--


function upload() {
	
		$('#form').submit();
	
}
//--></script>
<?php echo $footer; ?>